﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Linyou.Net7.BusinessInterface;
using Microsoft.AspNetCore.Authorization;
using Linyou.Net7.WebMinimalAPI.Utility.SwaggerExt;
using System.Linq.Expressions;

namespace Linyou.Net7.WebMinimalAPI
{
    public static class CompanyManager
    {
        public static void CompanyAPI(this WebApplication app)
        {
            //app.MapGet("/GetCompanyPage", [Authorize] (HttpContext httpContext, [FromServices] ICompanyService _ICompanyService, [FromBody] string searchString, int pageIndex, int pageSize) =>
            //{

            //    Expression<Func<Company, bool>> exer = c => true;
            //    if (!string.IsNullOrWhiteSpace(searchString))
            //    {
            //        exer = c => c.Name.Equals(searchString);
            //    }
            //    PageResult<Company> pageResult = _ICompanyService.QueryPage<Company, int>(exer, pageSize, pageIndex, c => c.Id, true);

            //    return pageResult;
            //})
            //.WithName("GetCompanyPage")
            //.WithOpenApi()
            //.WithDescription("分页获取公司信息");
        }
    }
}
